package com.mayuhao.permissionmanage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mayuhao.permissionmanage.entity.CssMenu;
import com.mayuhao.permissionmanage.entity.CssRole;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author 马宇豪
 * @since 2022-10-28
 */
@Mapper
public interface CssRoleMenuMapper extends BaseMapper<CssRole> {
    /**
     * @return java.util.List<com.mayuhao.permissionmanage.entity.CssRole>
     * @description 请修改方法描述
     * @methodName selectRoleMenu
     * @params [roleId]
     * @paramType [java.lang.Integer]
     * @author 马宇豪
     * @date 2022/10/28 0028 下午 3:20
     * @email 1757442521@qq.com
     **/
    @Select("SELECT * FROM css_menu")
    List<CssMenu> selectMenu();

    /**
     * @return boolean
     * @description 请修改方法描述
     * @methodName deleteroleMenu
     * @params [roleId]
     * @paramType [java.lang.String]
     * @author 马宇豪
     * @date 2022/10/28 0028 下午 4:26
     * @email 1757442521@qq.com
     **/
    @Delete("DELETE FROM css_role_menu WHERE css_role_menu.role_id =#{roleId}")
    boolean deleteroleMenu(@Param("roleId") String roleId);

    /**
     * @return boolean
     * @description 请修改方法描述
     * @methodName insertroleMenu
     * @params [roleId, menuId]
     * @paramType [java.lang.Integer, java.lang.Integer]
     * @author 马宇豪
     * @date 2022/10/28 0028 下午 4:33
     * @email 1757442521@qq.com
     **/
    @Insert("INSERT css_role_menu VALUES ( #{roleId}, #{menuId} )")
    boolean insertroleMenu(@Param("roleId") String roleId,
                           @Param("menuId") String menuId);

    @Select("SELECT css_role_menu.menu_id FROM css_role_menu WHERE css_role_menu.role_id = #{roleId}")
    List<String> boundRoleMenu(String roleId);

}
